import { getLocatoken, RemoveLocaToken, setLocatoken } from '@/utils/localhost'
import { getUserInfo } from '@/api/user'
const state = {
  token: getLocatoken() || {},
  UserInfo: {}
}
const mutations = {
  settoken(state, value) {
    setLocatoken(value)
    state.token = value
  },
  RemoveToken(state) {
    state.token = {}
    state.UserInfo = {}
    RemoveLocaToken()
  },
  getUserInfo(state, value) {
    state.UserInfo = value
  }
}

const actions = {
  async getUserInfoFn(context) {
    const res = await getUserInfo()
    context.commit('getUserInfo', res.data)
  }
}
const gettesrs = {}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  gettesrs
}
